from django.contrib.auth.mixins import LoginRequiredMixin
from django import http
from .response_code import RETCODE

"""继承响应JSON消息"""
class LoginRequiredJSONMixin(LoginRequiredMixin):
    """自定义判断用户是否登陆：返回JSON"""
    def handle_no_permission(self):
        """直接响应JSON数据"""
        return http.JsonResponse({'code':RETCODE.SESSIONERR,'errmsg':'用户未登陆'})



